package agt.game.test;

import android.graphics.Canvas;
import android.view.SurfaceView;

public class RenderThread extends Thread {
	
	private SurfaceView surface_;
	private boolean run_ = false;
	
	public RenderThread(GameSurface _surface) {
		surface_ = _surface;
	}
	
	public void setRunning(boolean _run) {
		run_ = _run;
	}
	
	@Override
	public void run() {
		Canvas canvas = null;
		while (run_) {
			canvas = surface_.getHolder().lockCanvas();
			if (canvas != null) {
				surface_.draw(canvas);
				surface_.getHolder().unlockCanvasAndPost(canvas);
			}			
		}
	}
}
